by Alex Stewart
	Purpose
See if the system is connected to the network using API functions

	Method
Use the InternetGetConnectedStateEx function. This function returns the connection name and other information about the network configuration.

    Private Sub Form_Load()
    Dim flags As Long
    Dim length As Long
    Dim connection_name As String
    Dim connected As Boolean
    Dim ctl As Control
    
        length = 256
        connection_name = Space$(length)
        connected = InternetGetConnectedStateEx(flags, connection_name, length, 0&)
    
        For Each ctl In Controls
            If TypeOf ctl Is CheckBox Then ctl.Value = vbUnchecked
        Next ctl
    
        If connected Then
            lblConnection.Caption = Left$(connection_name, InStr(connection_name, Chr$(0)) - 1)
    
            If flags And INTERNET_CONNECTION_CONFIGURED Then chkConfigured.Value = vbChecked
            If flags And INTERNET_CONNECTION_LAN Then chkLan.Value = vbChecked
            If flags And INTERNET_CONNECTION_MODEM Then chkModem.Value = vbChecked
            If flags And INTERNET_CONNECTION_OFFLINE Then chkOffline.Value = vbChecked
            If flags And INTERNET_CONNECTION_PROXY Then chkProxy.Value = vbChecked
            If flags And INTERNET_RAS_INSTALLED Then chkRASInstalled.Value = vbChecked
        End If
    End Sub

	Disclaimer
This example program is provided "as is" with no warranty of any kind. It is
intended for demonstration purposes only. In particular, it does no error
handling. You can use the example in any form, but please mention
www.vb-helper.com.
